export default {
    sumtotal(state){
        return state.cartlist.length
    },
    checkedtotal(state){
        if(state.cartlist.filter(item=>item.checked).length == 0)
        {
            return 0
        }
        return state.cartlist.filter(item=>item.checked).reduce((sum,goods)=>{
            return goods.count +sum
        },0)
    },
    totalmonry(state){
        return state.cartlist.filter(item=>item.checked).reduce((sum,good)=>{
            return sum+parseFloat(good.price)*good.count
        },0)
    },
    isallcheckd(state){
        if(state.cartlist.filter(item=>!item.checked).length!=0 || state.cartlist.length==0)
        return false
        return true
    }
}